<%= javascript_include_tag 'main/main.js' %>
<%= stylesheet_link_tag 'main/main.css' %>
<%= render "main/head" %>

<body class="main_background">
<div style="text-align: center;color: #ffffff;">
  <div class="currency_frame">
    <div class="sort_tag">
      <a style="background-color: <%= params[:sort_mode].to_i == 0 ? 'red':'#00000' %>" onclick="jump_page('/main/index?sort_mode=0&page=1')">时间从前到后</a>
      <a style="background-color: <%= params[:sort_mode].to_i == 1 ? 'red':'#00000' %>" onclick="jump_page('/main/index?sort_mode=1&page=1')">时间从后到前</a>
      <a style="background-color: <%= params[:sort_mode].to_i == 2 ? 'red':'#00000' %>" onclick="jump_page('/main/index?sort_mode=2&page=1')">赞数从小到大</a>
      <a style="background-color: <%= params[:sort_mode].to_i == 3 ? 'red':'#00000' %>" onclick="jump_page('/main/index?sort_mode=3&page=1')">赞数从大到小</a>
    </div>
    <%= form_tag  'add_note',:class => 'from',:multipart => true do%>
        <%= text_area_tag(:text, "", size: "30x3",:id => 'note_content') %>
        <div>选择图片
          <%= file_field_tag :localfile ,:id => 'note_image',:style => 'opacity:0;width: 70px;top: 130px;height: 60px;position: absolute;'%>
        </div>
        <%= button_tag "上传",:class =>'upload',:onclick => 'upload_button()'%>
    <% end %>
    <!--<button onclick="jump_page('/main/index?k=2')"></button>-->
    <% @get_notes.each do |get_note| %>
        <div class="note_fram">
          <div class="head_info_fram" onclick="jump_page('/main/get_user_info?user_name=<%= get_note[1].name %>')">
            <img src="<%= get_note[1].user_image %>" class="head_image">
            <div>
              <span class="left"><%= get_note[1].name %></span>
              <span class="left"><%= get_note[1].sex %></span>
              <br/>
            </div>
            <div>
              <br/>
              <span class="left"><%= get_note[0].created_at.to_s.slice(5,11) %></span>
            </div>
          </div>
          <div onclick="jump_page('/note_info/get_note?note_id=<%= get_note[0].id %>')">
            <p class="note_content"><%= get_note[0].content %></p>
            <img class="note_image " src="<%= get_note[0].note_photo %>">
          </div>
          <div class="comment_fram" >
            <div  class="margin-right-20 icon_fram" onclick="laud(<%= get_note[0].id %>)">
              <span id="laud<%= get_note[0].id %>"><%= get_note[2][1] %></span>
              (<span id="favor<%= get_note[0].id %>"><%= get_note[2][0] %></span>)
            </div>
            <div class="margin-right-20 icon_fram" onclick="get_comment_fram(<%= get_note[0].id %>)">
              <%= image_tag "reply",:class => 'icon' %>
              <span >评论</span>
            </div>
          </div>
          <div id="comment_input_fram<%= get_note[0].id %>" class="comment_input_fram">
            <textarea id="comment<%= get_note[0].id %>" rows="3" ></textarea>
            <button onclick="get_comment(<%= get_note[0].id %>,'<%= get_note[0].user_id %>')">回复</button>
          </div>
          <br/>
        </div>
    <% end %>
  </div>
  <button class="page_button" style="left: 354px;display: <%= @up_page == '首页'? 'none' : 'block' %>" onclick="jump_page('/main/index?sort_mode='+(<%= @sort_mode %>)+'&page='+(<%= @page_num.to_i %> -1)) "><%= @up_page %></button>
  <button class="page_button" style="right: 220px;display: <%= @next_page == '尾页'? 'none' : 'block' %>" onclick="jump_page('/main/index?sort_mode='+(<%= @sort_mode %>)+'&page='+ (<%= @page_num.to_i %> + 1))"><%= @next_page %></button>
</div>
</body>